package io.renren.modules.store.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.store.dao.TStoreStaffCommissionRecordDao;
import io.renren.modules.store.entity.TStoreStaffCommissionRecordEntity;
import io.renren.modules.store.entity.vo.FoodDiscountVo;
import io.renren.modules.store.entity.vo.StaffCommissionRecordVo;
import io.renren.modules.store.service.TStoreStaffCommissionRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;



@Service("tStoreStaffCommissionRecordService")
public class TStoreStaffCommissionRecordServiceImpl extends ServiceImpl<TStoreStaffCommissionRecordDao, TStoreStaffCommissionRecordEntity> implements TStoreStaffCommissionRecordService {

    @Autowired
    private TStoreStaffCommissionRecordDao commissionRecordDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TStoreStaffCommissionRecordEntity> page = this.page(
                new Query<TStoreStaffCommissionRecordEntity>().getPage(params),
                new QueryWrapper<TStoreStaffCommissionRecordEntity>()
                        .eq(!params.get("sellerId").equals(""),"seller_id",params.get("sellerId"))
        );

        return new PageUtils(page);
    }

    @Override
    public Page<StaffCommissionRecordVo> listCommissionRecord(Map<String, Object> params) {
        Page<StaffCommissionRecordVo> page = new Page<StaffCommissionRecordVo>
                (Long.parseLong((String) params.get("current")),Long.parseLong((String) params.get("size")));
        return commissionRecordDao.listCommissionRecord(page,params);
    }

}